
from PIL import Image
import numpy as np
import pandas as pd


def statisticalRGBvalue():
    img  =  Image.open("/data2/enducation/datas/answer_card/unet_data/20211105/labels/2021-10-16_02_07_44.jpg")
    img_np =  np.asarray(img)
    print(img_np)

def statisticalRGBvalue_pixel():
    im = Image.open("/data2/enducation/datas/answer_card/unet_data/20211108/mask_imgs/2021-10-16_02_07_44.png")
    # im = Image.open("/data2/enducation/image_segmentation/Pytorch-UNet-master/utils/2021-10-17_07_42_12.png")

    width = im.size[0]
    height = im.size[1]
    im = im.convert('RGB')
    array = []
    for x in range(width):
        for y in range(height):
            r, g, b = im.getpixel((x,y))
            rgb = (r, g, b)
            array.append(rgb)
    print(array)

if __name__ == '__main__':

    # statisticalRGBvalue()

    statisticalRGBvalue_pixel()



